//################################################################################################################################//
//##                                                                                                                            ##//    
//## This Page is implement for show the doctor content after Doctor's login                                                    ##//
//##                                                                                                                            ##//
//## Author   : Manish Prajapati                                                                                                ##//
//## Dated    : 17-03-2006                                                                                                      ##//
//##                                                                                                                            ##//    
//################################################################################################################################//
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SiteManager;
public partial class Doctor_doctorContent : System.Web.UI.Page
{
    // creating an instance of manager class
    Manager mgr = new Manager(true,"ConnectionString");
    protected bool isFeatured=false;
    protected void Page_Load(object sender, EventArgs e)
    {
        // COMMENTED TO AVOID LOGIN WHILE LOGGED IN AS DENTIST
        // DATE 15TH FEB 2008
        // if (Session["userID"] != null && Session["userID"].ToString() != "")
        localFunction obj = new localFunction();

        if (obj.checkDoctorLogin(true))
        // CODE MODIFICATION ENDS
        {
            if (!Page.IsPostBack)
            {
                //Fill Doctor Name and his/her speciality in your account box                
                ShowDrInformation();
            }
        }
        else
        {
            Response.Redirect(Session["strHttps"]+"doctor/doctorLogin.aspx");
        }
        
        Master.fVisible = true;

    }
    
    protected void ShowDrInformation()
    {
        //fetch doctor information using Session["userID"] from tbl_Doctors,tbl_Speciality
        string SQL = " SELECT  (tbl_Doctors.FName + ' ' + tbl_Doctors.MName  + ' ' + tbl_Doctors.LName) AS name,isnull(tbl_Speciality.Name,''), ";
        SQL += "isnull((select top 1 1 from tbl_bidding where trx_status=1 and dr_id=" + Session["userID"] + "),0) as isfeture ";
               SQL = SQL + " FROM " ;
               SQL = SQL + " tbl_Doctors LEFT OUTER JOIN tbl_Speciality ON tbl_Doctors.SpecialityID = tbl_Speciality.Id";
               SQL = SQL + " WHERE tbl_Doctors.Id = " + Session["userID"];

               using (System.Data.SqlClient.SqlDataReader dr = mgr.ExecuteQuery(SQL))
               {                   
                   if (dr.Read())
                   {                       
                       lblDoctorName.Text = dr.GetString(0);
                       lblSpeciality.Text = dr.GetString(1);
                       switch (dr.GetInt32(2))
                       {
                           case 1:
                   //            isFeatured = true;
                               break;
                           default:
                   //            isFeatured = false;
                               break;
                       }
                   }
                   dr.Close();
               }
               
               
    }
 
    protected void linkEditDrAccount_Click1(object sender, EventArgs e)
    {
        //Redirect page on doctorRegistration.aspx for edit the information of login doctor
        Session["pageFromOrAction"] = "Edit";
        Response.Redirect(Session["strHttps"].ToString()+"doctor/doctorRegistration.aspx");
    }
   
    protected void linkChangeDrPassword_Click1(object sender, EventArgs e)
    {
        //Redirect page on doctorForgotPass.aspx for retrive the forgot password
        //Response.Redirect("doctorChangePassword.aspx");
        Response.Redirect(Session["strHttp"].ToString() + "doctor/doctorChangePassword.aspx");
    }

    protected void Doctor_search1_Load(object sender, EventArgs e)
    {

    }
    protected void lnkViewProfile_Click(object sender, EventArgs e)
    {
        localFunction obj = new localFunction();
        obj.GetDrInfo(false); 
       // Response.Redirect("DoctorsDetails.aspx?id=" + Session["userid"].ToString());             
    }
    protected void lnkbtnResource_Click(object sender, EventArgs e)
    {
        //Response.Redirect("doctorResources.aspx?id=" + Session["userid"].ToString());
        Response.Redirect(Session["strHttp"].ToString() + "doctor/doctorResources.aspx?id=" + Session["userid"].ToString());
    }
    protected void lnkCommunity_Click(object sender, EventArgs e)
    {
        Response.Redirect(Session["strHttp"].ToString() + "Community/AddUpdateBlog.aspx");
    }
    protected void lbnMycalander_Click(object sender, EventArgs e)
    {
        Response.Redirect("DoctorCalendar.aspx?Id=" + Session["userid"].ToString());
    }
    protected void lbnMyFacePage_Click(object sender, EventArgs e)
    {
       
        Response.Redirect(Session["strHttp"].ToString() + "Community/FacePage.aspx?Page=" +"myFacePage" );
    }
}
